// 实例化Promise对象

const p = new Promise((resolve, reject) => {
  setTimeout(() => {
    /* let data = "用户数据";
    resolve(data); */

    let error = "失败了";
    reject(error);
  }, 1000);
});

p.then(
  value => {
    console.log(value);
  },
  reason => {
    console.error(reason);
  }
);
